package practice;

import org.junit.Test;
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class SampleTest {

	@Test
	public void shouldAbleToHandleAlert() throws InterruptedException{

	   WebDriver driver = new FirefoxDriver();
	   driver.get("https://mail.rediff.com/cgi-bin/login.cgi");
	   driver.findElement(By.name("proceed")).click();
	   Thread.sleep(3000);
	   Alert alert=driver.switchTo().alert();
	   System.out.println(alert.getText());
	   alert.accept();
	   driver.switchTo().defaultContent();
	   
	   Thread.sleep(2000);
	   
	   driver.get("http://timesofindia.com");
	   
	   Thread.sleep(2000);
	   
	   driver.quit();
	   
	
		   
	}

}
